﻿CREATE TABLE [dbo].[Integrante] (
    [IntegranteId]           INT           IDENTITY (1, 1) NOT NULL,
    [Dni]                    VARCHAR (10)  NOT NULL,
    [Nombre]                 VARCHAR (50)  NOT NULL,
    [Apellido]               VARCHAR (50)  NOT NULL,
    [Activo]                 BIT           NOT NULL,
    [TipoDocumentoId]        INT           NOT NULL,
    [FechaNacimiento]        DATE          NOT NULL,
    [Domicilio]              VARCHAR (100) NOT NULL,
    [Telefono]               VARCHAR (50)  NOT NULL,
    [EstadoCivilId]          INT           NOT NULL,
    [NivelEstudioId]         INT           NOT NULL,
    [NivelEstudioCompleto]   BIT           NULL,
    [PropiedadViviendaId]    INT           NOT NULL,
    [BeneficioPrevisionalId] INT           NOT NULL,
    [Monto]                  DECIMAL(10,2) NULL,
    [ObraSocialId]           INT           NULL,
    [NroAfiliado]            BIGINT        NULL,
    [ServicioEmergenciaId]   INT           NULL,
    [CuotaCooperadora]       DECIMAL(10,2) NULL,
    [FechaBaja]              DATE          NULL,
    [ObservacionBaja]        VARCHAR (300) NULL,
	[FechaInscripcion]		 DATE      NOT NULL DEFAULT GETDATE(),
    [Entrevista] VARCHAR(MAX) NULL, 
    CONSTRAINT [PK_Integrante] PRIMARY KEY CLUSTERED ([IntegranteId] ASC) WITH (FILLFACTOR = 80),
	CONSTRAINT [FK_Integrante_TipoDocumento] FOREIGN KEY ([TipoDocumentoId]) REFERENCES [dbo].[TipoDocumento] ([TipoDocumentoId]),
	CONSTRAINT [FK_Integrante_EstadoCivil] FOREIGN KEY ([EstadoCivilId]) REFERENCES [dbo].[EstadoCivil] ([EstadoCivilId]),
	CONSTRAINT [FK_Integrante_PropiedadVivienda] FOREIGN KEY ([PropiedadViviendaId]) REFERENCES [dbo].[PropiedadVivienda] ([PropiedadViviendaId]),
	CONSTRAINT [FK_Integrante_BeneficioPrevisional] FOREIGN KEY ([BeneficioPrevisionalId]) REFERENCES [dbo].[BeneficioPrevisional] ([BeneficioPrevisionalId]),
	CONSTRAINT [FK_Integrante_ObraSocial] FOREIGN KEY ([ObraSocialId]) REFERENCES [dbo].[ObraSocial] ([ObraSocialId]),
	CONSTRAINT [FK_Integrante_ServicioEmergencia] FOREIGN KEY ([ServicioEmergenciaId]) REFERENCES [dbo].[ServicioEmergencia] ([ServicioEmergenciaId]),
	CONSTRAINT [FK_Integrante_NivelEstudio] FOREIGN KEY ([NivelEstudioId]) REFERENCES [dbo].[NivelEstudio] ([NivelEstudioId])
);
